home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1992-11-18 | 61.0 KB | 1,691 lines | [ TEXT/MPS ]
C.S.M.P. Digest Sun, 08 Mar 92 Volume 1 : Issue 3 Today's Topics: Compiled version of xlisp Wanted: algorithm to calculate day-of-week from date Problem with CheckedOutFiles Goodie for MPW Programming with AppleTalk (In n) Making Folders invisible in Think C C String Types Sending an Apple Event with LaunchApplication... Palettes (Help me get these colors!) sqrt call using (in)SANE The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly. These digests are available (by using FTP, account anonymous, your email address as password) in the pub/mac directory on ftp.cs.uoregon.edu. This is also the home of the comp.sys.mac.programmer Frequently Asked Questions list. The articles in these digests are taken directly from comp.sys.mac.programmer. They are not edited; all articles included in this digest are in their original posted form. The only articles that are -not- included in these digests are those which didn't receive any replies (except those that give information rather than ask a question). All replies to each article are concatenated onto the original article in the order in which they were received. Article threads are not added to the digests until the last article added to the thread is at least one month old (this is to ensure that the thread is dead before adding it to the digests). Send administrative mail to mkelly@cs.uoregon.edu. ------------------------------------------------------- From: mbp@generali.harvard.edu (Mark B Palmerino) Subject: Compiled version of xlisp Date: 24 Jan 92 18:55:12 GMT Organization: Harvard University, Cambridge, MA Hi, I just procured the sources for a program called xlisp and it has some support for building it for the mac. Some of the documentation that came with it suggests that someone has already done this. Before I spend alot of time making it work, I was wondering if anyone knows where I might be able to pick up a compiled version from internet. Thanks much. -- Mark Palmerino mbp@wjh12.harvard.edu Voice: (617) 345-9500 - ------------------------- From: Thad.Humphries@p950.f70.n109.z1.FidoNet.Org (Thad Humphries) Subject: Compiled version of xlisp Date: 25 Jan 92 02:33:41 GMT MB> I just procured the sources for a program called xlisp and it has some MB> support for building it for the mac. Some of the documentation that came MB> with it suggests that someone has already done this. MB> MB> Before I spend alot of time making it work, I was wondering if anyone MB> knows where I might be able to pick up a compiled version from internet. Try stanford.edu (whatever they are). Version 2.0 crashes on a IIci under 6.0.5 (okay on earlier models) but you need 2.1 if you've got the IIci, si, etc. * Origin: Quis custodiet ipsos custodes? (1:109/70.950) --------------------------- From: jcav@quads.uchicago.edu (JohnC) Subject: Wanted: algorithm to calculate day-of-week from date Date: 24 Jan 92 16:49:44 GMT Organization: The Royal Society for Putting Things on Top of Other Things I need to determine the day of the week (Sunday,Monday,etc) of a given date. Any pointers to efficient algorithms for doing so? Is there a better newsgroup for posting questions of this sort? Shouldn't there be a "comp.algorithms"? Any help would be greatly appreciated. -- John Cavallino | EMail: jcav@midway.uchicago.edu University of Chicago Hospitals | John_Cavallino@uchfm.bsd.uchicago.edu Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953 B0 f++ c+ g+ k s+(+) e+ h- pv | Chicago, IL 60637 - ------------------------- From: ts@uwasa.fi (Timo Salmi) Subject: Wanted: algorithm to calculate day-of-week from date Date: 25 Jan 92 20:32:35 GMT Organization: University of Vaasa, Finland In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes: >I need to determine the day of the week (Sunday,Monday,etc) of a given date. >Any pointers to efficient algorithms for doing so? Is there a better Try garbo.uwasa.fi:/pc/ts/tsfaq25.zip Frequently Asked Questions. "If you do not know how to go about getting this package you are welcome to email me for the prerecorded garbo.uwasa.fi instructions, Keith Petersen (w8sdz@wsmr-simtel20.army.mil) for SIMTEL20 information, or Craig Warren (ccw@deakin.oz.au) for Oceanian garbo mirror information. North American users are advised first to search on SIMTEL20 or its mirror wuarchive.wustl.edu. Oceanian users are referred to rana.cc.deakin.oz.au (for recent files)." ................................................................... Prof. Timo Salmi Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.87.1 School of Business Studies, University of Vaasa, SF-65101, Finland Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun - ------------------------- From: fcs@teal.csn.org (M. Scott Marcy) Subject: Wanted: algorithm to calculate day-of-week from date Date: 26 Jan 92 01:26:02 GMT Organization: Colorado SuperNet, Inc. In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes: >I need to determine the day of the week (Sunday,Monday,etc) of a given date. >Any pointers to efficient algorithms for doing so? Is there a better >newsgroup for posting questions of this sort? Shouldn't there be a >"comp.algorithms"? Any help would be greatly appreciated. /***************************************************************************** * day_of_week * * This routine calculates the day of the week for the given date. It returns * a number in the range of 0 to 6, with 0 = Saturday, 1 = Sunday, * 2 = Monday, etc. * * year : the year as in 1991 * month : month number (1 = January, 2 = February, etc.) * day : day number (one based) *****************************************************************************/ short day_of_week(short year, short month, short day) { int n; /* Get the "day number" */ n = year - 1900; n += n / 4; n += month_offset[month - 1]; n += day; /* If it's January of Februaru of a leap year, subtract one day */ if (month <= 2 && year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) n--; return n % 7; } with month_offset defined as short month_offset[12] = {1,4,4,0,2,5,0,3,6,1,4,6}; This particular function only works for dates > 1900. Hope this helps! > > >-- >John Cavallino | EMail: jcav@midway.uchicago.edu >University of Chicago Hospitals | John_Cavallino@uchfm.bsd.uchicago.edu >Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953 >B0 f++ c+ g+ k s+(+) e+ h- pv | Chicago, IL 60637 -- M. Scott Marcy Internet: fcs@csn.org First Class Systems, Inc. Applelink: GBI.DEV PO Box 50005 Colorado Springs, CO 80949 USA Disclaimer: I own the company! - ------------------------- From: mbabramowicz@amherst.edu Subject: Wanted: algorithm to calculate day-of-week from date Date: 26 Jan 92 11:42:28 GMT Organization: Amherst College, Amherst, MA. In article <1992Jan24.164944.13436@midway.uchicago.edu>, jcav@quads.uchicago.edu (JohnC) writes: > I need to determine the day of the week (Sunday,Monday,etc) of a given date. > Any pointers to efficient algorithms for doing so? Is there a better > newsgroup for posting questions of this sort? Shouldn't there be a > "comp.algorithms"? Any help would be greatly appreciated. > > > -- > John Cavallino | EMail: jcav@midway.uchicago.edu > University of Chicago Hospitals | John_Cavallino@uchfm.bsd.uchicago.edu > Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953 > B0 f++ c+ g+ k s+(+) e+ h- pv | Chicago, IL 60637 If you are using a Mac, the feature is almost built in. First, fill in the fields of a DateTimeRec, ignoring fields like dayOfWeek. Then use the following code: Date2Secs(myDateTimeRec,mySecs); Secs2Date(mySecs,myDateTimeRec); Note: mySecs should be of type LongInt When you finish executing the code, the dayOfWeek field of myDateTimeRec will be properly filled in: it is ignored in the Date2Secs call but set in the Secs2Date call. Of course, this will only work for a limited span of years... If you need to figure out days of week over a longer period of time, you'll have to get a real algorithm. Years ago, I figured one out and memorized it so I could tell days of week quickly for dates, but, alas, it didn't end up really impressing people that much, so I forgot it. If you do get an algorithm, I'd appreciate it if you'd send it to me; I'm curious. Thanks, Michael - ------------------------- From: mmalson@x102c.ess.harris.com (Mark Malson) Subject: Wanted: algorithm to calculate day-of-week from date Date: 27 Jan 92 17:32:01 GMT Organization: Harris Corporation, GCSD, Melbourne, FL In article <1992Jan24.164944.13436@midway.uchicago.edu>, jcav@quads.uchicago.edu (JohnC) writes: > > I need to determine the day of the week (Sunday,Monday,etc) of a given date. > Any pointers to efficient algorithms for doing so? Is there a better > newsgroup for posting questions of this sort? Shouldn't there be a > "comp.algorithms"? Any help would be greatly appreciated. > I use Zellar's algorithm - learned it from my Computer teacher in high school - 1978? I'd be interested if anyone has ever seen this in print, because I seem to be the only one I know who knows it. Anway, here it is: g = ( int(2.6*m - .2) + d + y + int(y/4) + int(c/4) - 2*c) mod 7 Where: g = day of week: 0 = Sunday, 6 = Saturday m = month-2, NOTE: 1 = MARCH, 2 = APRIL, 3 = MAY, etc. 11 = JANUARY, 12 = FEBRUARY y = year mod 100 (i.e., 00-99). y must be decremented from actual year in case of January or February! d = day of month (1-31) c = century, or int(year/100). Same rule applies to c as to y, above. int(x) = integer portion of x, truncated. a mod b = modulo operation. Example: January 1, 1992: m = 11, d = 1, y = 91, c = 19 g = ( int(2.6*m - .2) + d + y + int(y/4) + int(c/4) - 2*c ) mod 7 = ( int(2.6*11 -.2) + 1 + 91 + int(91/4) + int(19/4) - 2*19 ) mod 7 = ( int(28.6-.2) + 1 + 91 + int(22.75)+ int(4.75) - 38 ) mod 7 = ( int(28.4) + 1 + 91 + 22 + 4 - 38 ) mod 7 = ( 28 + 1 + 91 + 22 + 4 - 38 ) mod 7 = 108 mod 7 = 3 (Wednesday) Here's some C code to implement it. Note the use of default truncation of integer division results. Also note that the result of the large equation could be negative. The mod operator sometimes returns a negative number if it is given a negative number, so you have to add 7 in that case. int Zellar (int month, int day, int year) { int cent, g; if ((month -= 2) < 1) { month += 12; year--; } cent = year / 100; year %= 100; g = ((26 * month - 2)/10 + day + year + year/4 + cent/4 - 2*cent) % 7; if (g<0) g += 7; /* adjust for possible neg result from % opr */ return g; } Here's a something I use almost as much to calculate the number of days in a month. It just figures out what DAY the first of the NEXT month is, and figures out what the 28th of THIS month is, and from that can figure out how many days in between those. May not the most efficient way to do it, but it ensures that any month that Zellar says is a "leap" month will be reported correctly. int DaysPerMonth (int month, int year) { int lastDOW, first, diff; lastDOW = Zellar (month, 28, year); if (++month > 12) { month = 1; year++; } first = Zellar (month, 1, year); diff = (first - lastDOW) % 7; if (diff<0) diff += 7; /* adjust for possible neg % result */ return (diff + 27); } Aside: Many people just want to compute leap years and can't remember the rule for what even centuries are and aren't leap years. If you're only dealing with present and future dates, simply checking to see if the year is divisible by 4 will work until March 1, 2100. 2000 WILL BE a leap year. Otherwise, I just use DaysPerMonth above. NOTE: None of these algorithms work correctly on dates before some time in 1752. They took out some days during that year to adjust for centuries of extra leap days or something like that. Anyway, if there is any chance of that, I always check to see if the year is >= 1753. - Mark Malson Staff Engineer Harris Corporation Government Communication Systems Division P.O. Box 91000 Melbourne, FL 32902 mmalson@x102c.ess.harris.com mmalson@m22af.ess.harris.com - ------------------------- From: phillips@grafted.UUCP (Mike Phillips) Subject: Wanted: algorithm to calculate day-of-week from date Date: 27 Jan 92 21:37:29 GMT Organization: GRAFTED, Central Indiana's Usenet BBS 317-881-4369 jcav@quads.uchicago.edu (JohnC) writes: > I need to determine the day of the week (Sunday,Monday,etc) of a given date. > Any pointers to efficient algorithms for doing so? Is there a better > newsgroup for posting questions of this sort? Shouldn't there be a > "comp.algorithms"? Any help would be greatly appreciated. Check out alt.cobol where a DOW algorithm was just posted in the last two or three days. It's generic, taken out of DDJ (Doctor Dobbs Journal) -- Mike Phillips The Grafted Branch BBS 317-881-4369 internet: phillips@grafted.UUCP uucp: ..!uunet!grafted.UUCP!phillips -= newsfeeds available, contact robert@towers.rn.com =- - ------------------------- From: plogan@mentorg.com (Patrick Logan) Subject: Wanted: algorithm to calculate day-of-week from date Date: 27 Jan 92 20:33:56 GMT Organization: Mentor Graphics Corporation In article <1992Jan27.173201.3568@trantor.harris-atd.com> mmalson@x102c.ess.harris.com (Mark Malson) writes: In article <1992Jan24.164944.13436@midway.uchicago.edu>, jcav@quads.uchicago.edu (JohnC) writes: > > I need to determine the day of the week (Sunday,Monday,etc) of a given date. > Any pointers to efficient algorithms for doing so? Is there a better > newsgroup for posting questions of this sort? Shouldn't there be a > "comp.algorithms"? Any help would be greatly appreciated. > I use Zellar's algorithm - learned it from my Computer teacher in high school - 1978? I'd be interested if anyone has ever seen this in print, because I seem to be the only one I know who knows it. Anway, here it is: [Example deleted] Zellar's Congruence is in _The T Programming Language: A Dialect of Lisp_ by Stephen Slade. I have a draft dated June 25, 1986. I think it was published in book form a year or two later. By who I do not know. The reference Slade gives is _Artificial Intelligence Programming_ by Charniak, Riesbeck, and McDermott, Lawrence Erlbaum Associates, Hillsdale, NJ, 1980. I used to have that, but no longer do. -- Patrick Logan, plogan@mentorg.com, Voice: (503) 685-7000 x2907, FAX: (503) 685-1282 Mentor Graphics Corp., Bldg. C, 8005 SW Boeckman Rd., Wilsonville, OR 97070 I can't gete the .signature virus and I can't gete the .signature - ------------------------- From: dsmall@mitre.org (Duane W. Small) Subject: Wanted: algorithm to calculate day-of-week from date Date: 28 Jan 92 17:40:39 GMT Organization: The MITRE Corporation In article <1992Jan27.173201.3568@trantor.harris-atd.com>, mmalson@x102c.ess.harris.com (Mark Malson) writes: > > In article <1992Jan24.164944.13436@midway.uchicago.edu>, jcav@quads.uchicago.edu (JohnC) writes: > > > > I need to determine the day of the week (Sunday,Monday,etc) of a given date. > > ... > I use Zellar's algorithm - learned it from my Computer teacher in high > school - 1978? I'd be interested if anyone has ever seen this in print, > because I seem to be the only one I know who knows it. Anway, here it is: > > g = ( int(2.6*m - .2) + d + y + int(y/4) + int(c/4) - 2*c) mod 7 > > Where: > g = day of week: 0 = Sunday, 6 = Saturday > > m = month-2, NOTE: 1 = MARCH, 2 = APRIL, 3 = MAY, etc. > 11 = JANUARY, 12 = FEBRUARY > y = year mod 100 (i.e., 00-99). y must be decremented from > actual year in case of January or February! > d = day of month (1-31) > c = century, or int(year/100). Same rule applies to c as to y, above. > int(x) = integer portion of x, truncated. > a mod b = modulo operation. > >... A somewhat more general algorithm uses the Julian day number (jdn): jdn = 367*year + int(275*month/9) - int(7*(year+int((month+9)/12))/4) - int(3*(1+int((year+int((month-9)/7))/100))/4) + day + 1721029 Months are numbered from 1 (January) to 12 (December). The terms (month+9)/12 and (month-9)/7 eliminate the need to start from March 1 and renumber the years. A quick analysis is 367 days per year 30 or 31 days per month (only February is incorrect) less 2 days per year (except 1 in leap years) at the end of February less 1 day at the turn of each century (when leap year is skipped), except once every four centuries (when it isn't skipped)-- again at the end of February plus the day of the month plus a constant to create a starting date of January 1, 4712 BC (No, I don't know why that starting date was chosen.) The day of the week is jdn mod 7, with Monday = 0 and Sunday = 6. I obtained the formula from a March 1988 posting by Walter Nissen (ZZI%NIHCU.BITNET@CUNYVM.CUNY.EDU) in an IBM PC newsgroup. He appeared to attribute it to "The Explanatory Supplement to the Astronomical Ephemeris and the American Ephemeris and Nautical Almanac prepared by the Nautical Almanac Offices of the United Kingdom and the USA." One obvious use of the formula is to compute the difference in days between two dates as jndlater - jdnearlier. Nissen claimed that the jdn has "many desirable properties," suggesting other uses (and perhaps accounting for the rather odd starting date?), but he did not elaborate. He did cite the Explanatory Supplement (he thought out of print, but available in libraries) as a good source of calendrical information. - ------------------------- From: cek@sdc.boeing.com (Conrad Kimball) Subject: Wanted: algorithm to calculate day-of-week from date Date: 2 Feb 92 05:20:34 GMT Organization: Boeing Computer Services (ESP), Seattle, WA In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes: >I need to determine the day of the week (Sunday,Monday,etc) of a given date. >Any pointers to efficient algorithms for doing so? Is there a better >newsgroup for posting questions of this sort? Shouldn't there be a >"comp.algorithms"? Any help would be greatly appreciated. Check out the Collected Algorithms of the ACM. This is a multiple-volume collection of algorithms put together by the Association for Computing Machinery (ACM). I don't remember which volume it's in, but there is just such an algorithm that you are looking for (I've used it in the past). -- -- Conrad Kimball Boeing Computer Services (206) 865-6410 Email: cek@sdc.boeing.com or cek%sdc@atc.boeing.com UUCP: uw-beaver!bcsaic!sdc!cek - ------------------------- From: rmitchel@bbn.com (Rob Mitchell) Subject: Wanted: algorithm to calculate day-of-week from date Date: 5 Feb 92 12:55:11 GMT cek@sdc.boeing.com (Conrad Kimball) writes: >In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes: >>I need to determine the day of the week (Sunday,Monday,etc) of a given date. >>Any pointers to efficient algorithms for doing so? Is there a better >>newsgroup for posting questions of this sort? Shouldn't there be a >>"comp.algorithms"? Any help would be greatly appreciated. >Check out the Collected Algorithms of the ACM. This is a multiple-volume >collection of algorithms put together by the Association for Computing >Machinery (ACM). I don't remember which volume it's in, but there is just >such an algorithm that you are looking for (I've used it in the past). Check this out ... DateTimeRec dtRec; long secs; dtRec.year = "your year"; /* 1904 ... 2040 */ dtRec.month = "your month"; /* 1=Jan .. 12=Dec */ dtRec.day = "your day"; /* 1 .. 31 */ dtRec.hour = "your hour"; /* 0 .. 23 */ dtRec.minute = "your minute; /* 0 .. 59 */ dtRec.second = "your second";/* 0 .. 59 */ /* dtRec.dayOfWeek not used *//* 1=Sun .. 7=Sat */ Date2Secs (&dtRec, &secs); /* receives "raw" secods since 1/1/1904 */ Secs2Date (secs, &dtRec); /* receives corresponding date and time */ /* Now check out the dtRec.dayOfWeek and use its value */ Disclaimer: never compiled or tested the above code, but it should work reasonably well. Later. Rob Mitchell (rmitchel@bbn.com) 617-873-4041 Macintosh and Unix Software Engineer These opinions are mine and mine only. - ------------------------- From: jxs18@po.CWRU.Edu (Jerry Sy) Subject: Wanted: algorithm to calculate day-of-week from date Date: 5 Feb 92 13:55:56 GMT Organization: Case Western Reserve University, Cleveland, OH (USA) In a previous article, cek@sdc.boeing.com (Conrad Kimball) says: >In article <1992Jan24.164944.13436@midway.uchicago.edu> jcav@midway.uchicago.edu writes: >>I need to determine the day of the week (Sunday,Monday,etc) of a given date. >>Any pointers to efficient algorithms for doing so? Is there a better >>newsgroup for posting questions of this sort? Shouldn't there be a >>"comp.algorithms"? Any help would be greatly appreciated. > >Check out the Collected Algorithms of the ACM. This is a multiple-volume >collection of algorithms put together by the Association for Computing >Machinery (ACM). I don't remember which volume it's in, but there is just >such an algorithm that you are looking for (I've used it in the past). >-- >-- > that is the theoretical way, the practical way (which I have always used) is just two steps. covert your date into raw seconds format using Date2Secs(..) and then convert the raw seconds into the long date format using IUDateString(..), then just extract the day of week out using your regular string functions. jerry --------------------------- From: xerox@coos.dartmouth.edu (Jamie Osborne) Subject: Problem with CheckedOutFiles Goodie for MPW Date: 24 Jan 92 21:58:07 GMT Organization: Dartmouth College, Hanover, NH I am trying to use the CheckedOutFiles script, written by scott douglass and Darin Adler, that was included in the Goodies stuff for MPW. I have not been able to get it to work, and it seems that the problem lies in a regexp that is used in the script. I've fiddled with it alot, but I was hoping that someone might have a working version of the script, and wouldn't mind emailing it to me. Here is a dump of how the script progresses when I run it. Unfortunately, the control characters can not be displayed correctly here. Thanks! -J - -------------- If 1 ... End Set somewhere "\B7\\B7\ 'Intrepid:DEVELOP:MPW:Worksheet'" Else end Set FirstNotOpened "" Set OthersNotOpened "" Begin ... End \B7\\B7\ 'Intrepid:DEVELOP:MPW:Worksheet' CheckedOutFiles -m Alias UsageError 'Alert ""{0} {Parameters}" doesn't make sense.\B6\nUsage: "{0} [-project project | -m]"" ; Exit 1' Set Exit 0 Begin ... End Set Options "" Set Project "" If 1 == 2 && "-m" =~ /-project/ ... End Else If 1 == 1 && "-m" =~ /-m/ If == "" ... End Set Options "-m" Else end Else If 1 <> 0 end CheckOutDir -r -m Set CheckOutDirStatus 0 Echo Set CheckOutDirs "CheckOutDir -project temp\BA\ -x " If 0 ... End end Loop ... End Break If "CheckOutDir -project temp\BA\ -x " !~ / *CheckOutDir +-project \B6\'<<0,1>>([\C2\:]+\BA\)(R)1\B6\'<<0,1>> \B6\'<<0,1>>([\C2\\BA\]*:)(R)2\B6\'<<0,1>> (\C5\)(R)3/ end If "CheckOutDir -project temp\BA\ -x " <> "" ... End Echo "### CheckedOutFiles - Couldn't parse CheckOutDirs: CheckOutDir -project temp\BA\ -x " > Dev:StdErr ### CheckedOutFiles - Couldn't parse CheckOutDirs: CheckOutDir -project temp\BA\ -x Exit 1 For File In ... End end If "" <> "" ... End end end -- Jamie Osborne | email: Jamie.Osborne@dartmouth.edu Student (ENGL && CS)/ Programmer | Disclaimer:I get paid for code, not opinions. "The best thing you ever done for me is to help me take my life less seriously. It's only life, after all." -Indigo Girls - ------------------------- From: xerox@coos.dartmouth.edu (Jamie Osborne) Subject: Problem with CheckedOutFiles Goodie for MPW Date: 24 Jan 92 22:57:58 GMT Organization: Dartmouth College, Hanover, NH xerox@coos.dartmouth.edu (Jamie Osborne) writes: >I am trying to use the CheckedOutFiles script, written by scott douglass and >Darin Adler, that was included in the Goodies stuff for MPW. I have not >been able to get it to work, and it seems that the problem lies in a regexp >that is used in the script. I've fiddled with it alot, but I was hoping that >someone might have a working version of the script, and wouldn't mind emailing >it to me. Here is a dump of how the script progresses when I run it. >Unfortunately, the control characters can not be displayed correctly here. >Thanks! >-J >---------------- >---- Stuff deleted I discovered the problem, but I don't think that it's anything that I can fix on any serious basis. Here's what part of the CheckedOutFiles script looks like: Set CheckOutDirs "`CheckOutDir -r {Options} {Project}; Set CheckOutDirStatus {Status}; Echo`" If {CheckOutDirStatus} Echo "### {0} - CheckOutDir failed." > Dev:StdErr Exit 1 End Loop Break If "{CheckOutDirs}" !~ / *CheckOutDir +-project \B6\'<<0,1>>([\C2\:]+\BA\)(R)1\B6\'<<0,1>> \B6\'<<0,1>>([\C2\\BA\]*)(R)2\B6\'<<0,1>> (\C5\)(R)3/ Set Project "{(R)1}" Set CheckOutDir ":" Set CheckOutDirs "{(R)3}" The first thing it does is set the value of CheckOutDirs by using the -r flag. According to the MPW Commando, if no check out directory is specified the current check out directories will be written to standard output in the form of another CheckOutDir command. If you look at the Break If... line, you'll see that the regexp depends on this for the second variable that it sets. It requires : to be the last character in the word. Unfortunately, it seems that CheckOutDir does not do this. Instead, it writes out a -x parameter (eg. CheckOutDir -project temp\BA\ -x). This says to reset the checkout directory to the default. Because the script at the Break if... line depends on the directory name being there, and not the -x, it fails. I solved this, for the time being, by requiring that you be in the check out directory before executing the opencheckedoutfiles command. Notice that I set the value of CheckOutDir to the current directory. If anyone has a more robust and correct solution, I'd be very happy to see it. Thanks. -- Jamie Osborne | email: Jamie.Osborne@dartmouth.edu Student (ENGL && CS)/ Programmer | Disclaimer:I get paid for code, not opinions. "The best thing you ever done for me is to help me take my life less seriously. It's only life, after all." -Indigo Girls --------------------------- From: kai@dvpj.sony.co.jp (Masamitsu Kai) Subject: Programming with AppleTalk (In n) Date: 25 Jan 92 01:40:07 GMT Organization: Sony Corporation, PC Div. A Project Office, Tokyo Japan I am beginner of Pascal Programming and studying AppleTalk. The reference book is "Macintosh Inside Out: Programming with AppleTalk".The example is "RemoteSysInfo: An RDEV/INIT Example Program". (1)INIT (2)RDEV (3)ExEC I successed programming (1). But I didn't successe (2) and (3). Is there person who successed the programming ? Thanks in advance. - ----------------------------------------------------------------------- Sony Masamitsu Kai E-Mail: kai@dvpj.sony.co.jp -- Masamitsu Kai kai@dvpj.sony.co.jp (J - ------------------------- From: peirce@outpost.SF-Bay.org (Michael Peirce) Subject: Programming with AppleTalk (In n) Date: 26 Jan 92 04:01:44 GMT Organization: Peirce Software In article <12390@dvpjgw.dvpj.sony.co.jp> (comp.sys.mac.programmer), kai@dvpj.sony.co.jp (Masamitsu Kai) writes: > I am beginner of Pascal Programming and studying AppleTalk. The reference > book is "Macintosh Inside Out: Programming with AppleTalk".The example is > "RemoteSysInfo: An RDEV/INIT Example Program". > (1)INIT > (2)RDEV > (3)ExEC > I successed programming (1). But I didn't successe (2) and (3). > Is there person who successed the programming ? > > Thanks in advance. Anyone who wants the source code can send me mail and I'll forward it to them. -- Michael Peirce -- peirce@outpost.SF-Bay.org -- Peirce Software -- Suite 301, 719 Hibiscus Place -- Macintosh Programming -- San Jose, California USA 95117 -- & Consulting -- voice: (408) 244-6554 fax: (408) 244-6882 -- -- AppleLink: peirce & America Online: AFC Peirce --------------------------- From: kacovert@miavx1.acs.muohio.edu Subject: Making Folders invisible in Think C Date: 24 Jan 92 19:54:28 GMT Organization: Miami University Academic Computer Service I have written the following piece of code to toggle a file (in this example TEST) between being hidden and being visible. I would like to do the same for directories, but have as of yet been unsuccessful. Could someone please help? An example would be great. I would appreciate it if you could respond by mail. I don't get a chance to read this newgroup very often. #include <stdio.h> #include <Files.h> #include <pascal.h> main() { int OSErr; FInfo fndrInfo; if ((OSErr=GetFInfo("\pHard Disk:TEST",0,&fndrInfo)) != 0) { printf("Error in getting TEST information: %d\n",OSErr); } else { fndrInfo.fdFlags = fndrInfo.fdFlags ^ fInvisible; if ((OSErr=SetFInfo("\pHard Disk:TEST",0,&fndrInfo)) != 0) { printf("Error in changing TEST: %d\n",OSErr); } else { if ((fndrInfo.fdFlags & fInvisible) == fInvisible) printf("Control Panels is now invisible\n"); else printf("Control Panels is now visible\n"); } } } Any help would be appreciated. -- Kent Covert Academic Computer Service Miami University, Oxford, OH kacovert@miavx1.aps.muohio.edu (internet) kacovert@miavx1 (bitnet) - ------------------------- From: kacovert@miavx1.acs.muohio.edu Subject: Making Folders invisible in Think C Date: 25 Jan 92 17:01:26 GMT Organization: Miami University Academic Computer Service In article <1992Jan24.145428.8653@miavx1.acs.muohio.edu>, kacovert@miavx1.acs.muohio.edu writes: > I have written the following piece of code to toggle a file (in this example > TEST) between being hidden and being visible. I would like to do the same for > directories, but have as of yet been unsuccessful. Could someone please help? > An example would be great. I would appreciate it if you could respond by mail. > I don't get a chance to read this newgroup very often. [program, etc. deleted...] I apologize. I gave the wrong address in my signature. The following addresses should be correct. Sorry for any confusion. -- Kent Covert Academic Computer Service Miami University, Oxford, OH kacovert@miavx1.acs.muohio.edu (internet) kacovert@miavx1 (bitnet) - ------------------------- From: buckeye@spf.trw.com (John Wallace) Subject: Making Folders invisible in Think C Date: 31 Jan 92 02:27:49 GMT Organization: TRW Data Systems Center, Redondo Beach, CA In article <1992Jan24.145428.8653@miavx1.acs.muohio.edu> kacovert@miavx1.acs.muohio.edu writes: >I have written the following piece of code to toggle a file (in this example >TEST) between being hidden and being visible. I would like to do the same for >directories, but have as of yet been unsuccessful. Could someone please help? >An example would be great. I would appreciate it if you could respond by mail. >I don't get a chance to read this newgroup very often. > >#include <stdio.h> >#include <Files.h> >#include <pascal.h> >main() >{ > int OSErr; > FInfo fndrInfo; > > if ((OSErr=GetFInfo("\pHard Disk:TEST",0,&fndrInfo)) != 0) > { printf("Error in getting TEST information: %d\n",OSErr); } > else > { fndrInfo.fdFlags = fndrInfo.fdFlags ^ fInvisible; > if ((OSErr=SetFInfo("\pHard Disk:TEST",0,&fndrInfo)) != 0) > { printf("Error in changing TEST: %d\n",OSErr); } > else > { if ((fndrInfo.fdFlags & fInvisible) == fInvisible) > printf("Control Panels is now invisible\n"); > else > printf("Control Panels is now visible\n"); > } > } >} > This is not supported under System 6's Finder. It does hide files marked as invisible, but it draws folders no matter what their invisible bit says. However, you'll be happy to know that your code should work just fine under System 7. (If anyone knows how to trick Finder 6.x, it'd be neat to know. The only way I can figure to do this is to tail-patch GetCatInfo, returning information about the folder as if it was a file. You could do this by setting its ioFlAttrib to 0 and then faking all of the other information.) John -- John Wallace (buckeye@spf.trw.com) Phone: (213)812-7409 FAX: (213)812-8800 TRW, One Space Park R2/2162, Redondo Beach, CA 90278 - ------------------------- From: stoodt@cis.umassd.edu (Michael Stoodt) Subject: Making Folders invisible in Think C Date: 31 Jan 92 15:43:02 GMT Organization: University of Massachusetts Dartmouth In <2988B425.2B52@deneva.sdd.trw.com> buckeye@spf.trw.com (John Wallace) writes: >This is not supported under System 6's Finder. It does hide files marked >as invisible, but it draws folders no matter what their invisible bit >says. However, you'll be happy to know that your code should work just >fine under System 7. This does not appear to be correct. We used to use Resedit to set the System Folder invisible on the Macintoshes in our labs, and and under 6.* Finder was perfectly happy not showing it. Perhaps the Inited bit needs to be cleared as well, to let the Finder see that something's been changed? (Now we're running System 7, where if you set the System Folder invisible you don't get anything in the Apple Menu...) Michael Stoodt stoodt@cis.umassd.edu --------------------------- From: am137@cleveland.Freenet.Edu (Martin Wojbor Woyczynski) Subject: C String Types Date: 25 Jan 92 19:41:57 GMT Organization: Case Western Reserve University, Cleveland, Ohio, (USA) I hope someone has a simple answer to this simple question: In THINK C 5.0, how might one most easily copy an OSType string into a Str255? I have tried all the obvious(to me) ways and have had no luck. Thanks in advance, Martin W. am137@po.cwru.edu am137@cleveland.freenet.edu - ------------------------- From: ABSURD@applelink.apple.com (Tim Dierks, ToyMeister, Cray abuser) Subject: C String Types Date: 28 Jan 92 21:25:08 GMT Organization: MacDTS, Apple Computer In article <1992Jan25.194157.13265@usenet.ins.cwru.edu>, am137@cleveland.Freenet.Edu (Martin Wojbor Woyczynski) writes: > > In THINK C 5.0, how might one most easily copy an > OSType string into a Str255? I have tried all the obvious(to me) > ways and have had no luck. Because an OSType is 4 characters, you know you want to create a 4-character string where the 4 characters are the data in the (longword) OSType. Thus, OSType type; Str255 text; [...] text[0] = 4; /* String will be 4 characters long */ BlockMove(&type,&text[1],4); /* Move in the characters */ BlockMove is incredible overkill here- it probably takes two or three orders of magnitude longer to move 4 bytes than is really required, but it demonstrates the action. I would have just transferred a long word, like so: *(long *)&text[1] = type; but this will generate an address error on 68000 machines, because they cannot transfer a long word to an odd address, and the string will usually start on an even boundary, which means the second byte (first after the length) is usually at an odd address. Hope this helps Tim Dierks MacDTS, but I speak for myself --------------------------- From: greeny@top.cis.syr.edu (Jonathan Greenfield) Subject: Sending an Apple Event with LaunchApplication... Date: 26 Jan 92 00:21:51 GMT Organization: CIS Dept., Syracuse University The parameter block for LaunchApplication contains a launchAppParameters which is a pointer to an AppParameters record: type AppParameters=record theMsgEvent: EventRecord; eventRefCon: LongInt; messageLength: LongInt; messageBuffer: array[0..0] of SignedByte end; I would like to Launch an application sending it an "Open Documents" message rather than the default "Open Application" message. I have successfully created and sent Apple Events in the past using the standard AESend posting mechanism. I can't, however, figure out how to send an Apple Event using the AppParameters record. Could some kind soul please explain to me how this should be done? Many thanks. -- greeny greeny@top.cis.syr.edu "What's the difference between an orange?" - ------------------------- From: Joe.Francis@dartmouth.edu (Joe Francis) Subject: Sending an Apple Event with LaunchApplication... Date: 26 Jan 92 21:51:47 GMT Organization: Dartmouth College, Hanover, NH In article <1992Jan25.192151.12966@newstand.syr.edu> greeny@top.cis.syr.edu (Jonathan Greenfield) writes: > I have successfully > created and sent Apple Events in the past using the standard AESend posting > mechanism. I can't, however, figure out how to send an Apple Event using > the AppParameters record. There is a "snippets" folder available on ftp.apple.com for doing exactly that. Look in dts:mac:sc:snippets, I believe. There are a bunch of stuffed folders in there named for the months they were released. I can't remember which one has the sample code you want, probably October 91's. - ------------------------- From: dwright@jarthur.claremont.edu (Dan "(" Wright)) Subject: Sending an Apple Event with LaunchApplication... Date: 29 Jan 92 04:33:55 GMT Organization: Harvey Mudd College, Claremont, CA 91711 Create an odoc AppleEvent, then use AECoerceDesc to convert it into typeAppParameters. - Dan -- Dan Wright, Harvey Mudd College, CA: dwright@sif.claremont.edu --------------------------- From: mickey@athena.mit.edu (Phrank Yeean Chan) Subject: Palettes (Help me get these colors!) Date: 26 Jan 92 04:43:58 GMT Organization: Massachusetts Institute of Technology I have this "pltt" resource (I can use a "CLUT" resource if it helps) with 200 colors of the rainbow and 16 greys. When I open this resource in ResEdit, the colors and greys are ordered progressing from red to blue and white to black, respectively. In my program (Think C), I get this resource and load the palette. I set up a loop from 0 to 255 to display all the colors. Unfortunately, the colors and greys are not ordered anymore. Actually, they are ordered differently. It's as if the Toolbox has selected every 16th color in loading the new colors. Does anyone know how I can read the colors in order? I'm trying to draw a gradient, and it's going to be hell if I have to hop around the palette to get a set of continuous colors. Thanks in advance, Frank -- - ----------------------------------------------------------------------- ()_() mickey@athena.mit.edu "Trust me. I know what I'm doing." (_) Phrank Yeean Chan -- Sledge Hammer (1986-1988) - ----------------------------------------------------------------------- - ------------------------- From: lstein@athena.mit.edu (Lincoln Stein) Subject: Palettes (Help me get these colors!) Date: 26 Jan 92 14:35:56 GMT Organization: Massachusetts Institute of Technology If I understand you rightly you wish to display, in sequence, all the colors in a palette resource. What you should do, then, is something like this: 1. In ResEdit, make sure the 'usage' of each of your colors is set to pmTolerant, with a tolerance factor of $5000 or less ($0000 if you want those exact colors). 2. In your program, call GetNewPalette to fetch a PaletteHandle based on the pltt resource. 3. Open up and display a color window, using NewCWindow or GetNewCWindow. 4. Call SetPalette with your palette handle and color window to associate them. From now on, the palette will become active whenever the window sees an activate event. If necessary, the system will swap the palette's colors into the system clut, causing a colorful background flash. 5. To display the colors, loop from index 0 to the number of colors in the palette - 1. For each index call PmForeColor(index). Then draw a filled rectangle, or whatever. 6. When done with the palette, call DisposePalette to release its colors. ======================================================================== Lincoln D. Stein Brigham & Women's Hospital lstein@hstbme.mit.edu Boston, MA ======================================================================== - ------------------------- From: mbabramowicz@amherst.edu Subject: Palettes (Help me get these colors!) Date: 26 Jan 92 11:30:52 GMT Organization: Amherst College, Amherst, MA. In article <1992Jan26.044358.15263@athena.mit.edu>, mickey@athena.mit.edu (Phrank Yeean Chan) writes: > I have this "pltt" resource (I can use a "CLUT" resource if it helps) > with 200 colors of the rainbow and 16 greys. When I open this resource > in ResEdit, the colors and greys are ordered progressing from red to blue > and white to black, respectively. > > In my program (Think C), I get this resource and load the palette. I set up > a loop from 0 to 255 to display all the colors. Unfortunately, the colors > and greys are not ordered anymore. Actually, they are ordered differently. > It's as if the Toolbox has selected every 16th color in loading the new colors. > > Does anyone know how I can read the colors in order? I'm trying to draw > a gradient, and it's going to be hell if I have to hop around the palette > to get a set of continuous colors. > > Thanks in advance, > Frank > -- > ------------------------------------------------------------------------- > ()_() mickey@athena.mit.edu "Trust me. I know what I'm doing." > (_) Phrank Yeean Chan -- Sledge Hammer (1986-1988) > ------------------------------------------------------------------------- The situation you describe seems very odd to me, because when I worked with the Palette Manager, and used GetEntryColor to load colors from the palette, they did load in the same order I had placed them... Maybe you are misdiagnosing the problem? --------------------------- From: scott@phylo.life.uiuc.edu (Scott Howard) Subject: sqrt call using (in)SANE Date: 26 Jan 92 07:00:10 GMT Organization: University of Illinois at Urbana This must seem like a lazy/stupid question, but after spending the last 9 hours trying to get it myself, I figure its easier to post a query here than to pay for the monitor I'm going to kick in. :-) What exactly is wrong with this statement: GalaxyData[galaxy].StarData[star].Velocity[xyz] = (sqrt((Target_MassUnits/Distance_from_Galactic_Center)); The element Velocity is declared as a long double, the two labels on the right hand side of the assignment are Constants declared as integral values. The compiler flags this line, the first statement in a for loop: I am #including <SANE.h>, followed by <Math.h>, with 020 and 881 code generation options on. Excess verbiage ahead, hit 'next' Any and all casting I've attempted with this delightful assignment statement have produced identical results. Kudos to any and all suggestions in advance (and a large raspberry to building number one in Cupertino for forcing casual programmers to buy yet another manual just to get a crack at one or two simple transcendental functions.) -- All views expressed are copyright 1992 Scott Howard. Any resemblance to living persons, historical events, or logically constructed arguements are purely unintentional. - ------------------------- From: ralph@mso.anu.edu (Ralph Sutherland) Subject: sqrt call using (in)SANE Date: 26 Jan 92 23:48:22 GMT Organization: Mt. Stromlo Observatory > scott@phylo.life.uiuc.edu (Scott Howard) aksed: > > What exactly is wrong with this statement: > > GalaxyData[galaxy].StarData[star].Velocity[xyz] = > (sqrt((Target_MassUnits/Distance_from_Galactic_Center)); ........^....................................................... Have you counted your brackets?!? cheers ralph -- - -- Ralph S. Sutherland Mount Stromlo & Siding Spring Observatories. - -- ralph@madras.anu.edu.au The Australian National University. - -- rss100@csc2.anu.edu.au -------------------------------------------- - ------------------------- From: scott@phylo.life.uiuc.edu (Scott Howard) Subject: sqrt SUMMARY and Thanks. Date: 27 Jan 92 14:54:46 GMT Organization: University of Illinois at Urbana As everyone correctly pointed out, I mistyped the brackets. My source does have the correct number however. The problem I encountered stems from the '881 code generation option- one cannot have '881 and SANE overlapping. Since I need to generate '881 code from time to time in my project, I'll try isolating the calls in the functions that need it and use #pragma directives. Thanks again for all the responses. -- All views expressed are copyright 1992 Scott Howard. Any resemblance to living persons, historical events, or logically constructed arguements is purely unintentional. - ------------------------- From: gmarzot@mitre.org (G. S. Marzot (Joe)) Subject: sqrt call using (in)SANE Date: 27 Jan 92 14:49:26 GMT Organization: The MITRE Corporation In article <scott.696409224@phylo> scott@phylo.life.uiuc.edu (Scott Howard) writes: > GalaxyData[galaxy].StarData[star].Velocity[xyz] = > (sqrt((Target_MassUnits/Distance_from_Galactic_Center)); ... > The compiler flags this line, the first statement in a for loop: > I am #including <SANE.h>, followed by <Math.h>, with 020 and 881 code > generation options on. I believe you should include math.h before SANE.h because the SANE version wants an Extended type which may be different from long double. Check out the use of native floating point compiler option versus unversal floating point in Think C ( I assume you are using 5.0 or greater). I find using native FP and 020/881 is the fastest and I rarely am forced to use the SANE versions of math calls but when I do I just convert from the 96bit FP format to the 80bit SANE extended format before the SANE call and then back after. -GSM Email: gmarzot@linus.mitre.org (standard disclaimer) - ------------------------- From: ABSURD@applelink.apple.com (Tim Dierks, ToyMeister, Cray abuser) Subject: sqrt SUMMARY and Thanks. Date: 28 Jan 92 21:03:34 GMT Organization: MacDTS, Apple Computer In article <scott.696524100@phylo>, scott@phylo.life.uiuc.edu (Scott Howard) writes: > The problem I encountered stems from the '881 code generation > option- one cannot have '881 and SANE overlapping. Since I need > to generate '881 code from time to time in my project, I'll > try isolating the calls in the functions that need it and > use #pragma directives. This is one of the most difficult things to construct on the Mac at the moment; a program that uses 881 or SANE as required. (Forgive me if that wasn't the original intent). It's complicated by the fact that they must use seperate libraries for all their math functions, which is only compounded by the fact that they use different floating point types- even the _size_ of the extended type changes from '881 code to SANE. This makes it extremely difficult to mix the two types of code. Unfortunately, this is currently a problem without a solution; if anyone has good techniques for working around these difficulties, I'd love to hear them. Tim Dierks MacDTS, but I speak for myself - ------------------------- From: orpheus@reed.edu (P. Hawthorne) Subject: SANE or Sadie One (was Re: sqrt SUMMARY and Thanks.) Date: 31 Jan 92 02:21:48 GMT Organization: Reed College, Portland OR ABSURD@applelink.apple.com (Tim Dierks, ToyMeister, Cray abuser) writes: . This is one of the most difficult things to construct on the Mac at the . moment; a program that uses 881 or SANE as required.... . Unfortunately, this is currently a problem without a solution. It requires some care just to make a program which uses a 6888n and can warn the user if they don't have one. Adapting the program to whatever happens to be available does seem a worthy goal, if somewhat ambitious. It would mean stepping on the toes of mighty Microsoft Excel, so I'm in. Doesn't Excel do this? How does it do it? Is there a better way? What does PseudoFPU do again? Never downloaded it, since I have an FPU. . It's complicated by the fact that they must use seperate libraries for . all their math functions... In an application I am writing, the user can roll their own atomic data types and just provide the app with a module file. The module is called at the appropriate times, but the internal data types are assuming the existence of a math coprocessor. To tell the truth, I have been assuming the existence of math hardware for a good long while now. It has to do with being a speed freak, I think. If there is a good way to condescend to the lowest common denominator, I would be disappointed to think that it would significantly affect the performance for the highest. Perhaps a given application should jump to an offset from a given code resource, whichever one happens to be loaded into a global variable. The application could determine which resource to load at launch time. I did, however, notice that there has been some success with modifying the jump table. A practical idea? . Which is only compounded by the fact that they use different floating . point types... Even the size of the extended type changes from '881 code . to SANE. So much for strong typing. It's one of those things that the Sadie One book from Motorola doesn't give any hints for. This is the fly in the ointment, IMHO from a higher level perspective. Just out of curiosity, why doesn't SANE use the same extended real data format as the hardware does? Not griping about SANE, of course, but isn't it a possibility? Theus orpheus@reed.edu - ------------------------- From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) Subject: SANE or Sadie One Date: 1 Feb 92 06:08:13 GMT Organization: University of Waikato, Hamilton, New Zealand In article <1992Jan31.022148.20407@reed.edu>, orpheus@reed.edu (P. Hawthorne) asks: > Just out of curiosity, why doesn't SANE use the same extended real data > format as the hardware does? Not griping about SANE, of course, but isn't > it a possibility? Could it be because SANE came out somewhat before the 68881 did? Shouldn't the question be the other way around? Why didn't Motorola stick to 80-byte reals, why did they *have* to put in that extra unused word and cause all these compatibility problems? I don't buy the "alignment" argument. If I want to align things for speed, I'm perfectly capable of doing it myself. Lawrence D'Oliveiro fone: +64-7-856-2889 Computer Services Dept fax: +64-7-838-4066 University of Waikato electric mail: ldo@waikato.ac.nz Hamilton, New Zealand 37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00 To someone with a hammer and a screwdriver, every problem looks like a nail with threads. - ------------------------- From: orpheus@reed.edu (P. Hawthorne) Subject: SANE or Sadie One Date: 31 Jan 92 07:17:18 GMT Organization: Reed College, Portland OR orpheus@reed.edu (Theus) asks: : Just out of curiosity, why doesn't SANE use the same extended real data : format as the hardware does? ldo@waikato.ac.nz (Lawrence D'Oliveiro) counters: : Shouldn't the question be the other way around? Why didn't Motorola : stick to 80-byte reals, why did they *have* to put in that extra unused : word and cause all these compatibility problems? Legend has it that SANE was informally the model for the IEEE Standard for Binary Floating Point Arithmetic, upon which Sadie was based. Given how Motorola just loves longword alignment, maybe the reason for the 64-bit mantissa was to take advantage of what would otherwise have been wasted bits in the instruction stream. Those 80-bit registers in the Sadie would have been prime for software SANEs extended format. Sigh. I wonder if we are making too much of this issue. Aside from being able to convert between the formats when appropriate, which is easy, how can a single application use either hardware or SANE without sacrificing performance if the hardware is present? Theus (orpheus@reed.edu) - ------------------------- From: neeri@jupiter.ethz.ch (Matthias Ulrich Neeracher) Subject: SANE or Sadie One Date: 31 Jan 92 22:12:31 GMT Organization: Integrated Systems Laboratory, ETH, Zurich In article <1992Jan31.071718.11583@reed.edu> orpheus@reed.edu (P. Hawthorne) writes: > I wonder if we are making too much of this issue. Aside from being able >to convert between the formats when appropriate, which is easy, how can a >single application use either hardware or SANE without sacrificing >performance if the hardware is present? I wonder that noone has mentioned this so far, but don't there exist utilities like Omega SANE which replace SANE calls with coprocessor instructions (i.e. the first time an applications makes a SANE call, the call is inline replaced by 6888X instructions) ? Apart from being ugly, this solution seems to work well enough. Matthias - --- Matthias Neeracher neeri@iis.ethz.ch "You must have picked up that copy of Scarlett instead of Inside Mac when you tried to find the right call..." -- Keith Rollin - ------------------------- From: keith@Apple.COM (Keith Rollin) Subject: SANE or Sadie One Date: 3 Feb 92 03:18:51 GMT Organization: Apple Computer Inc., Cupertino, CA In article <NEERI.92Jan31141231@jupiter.ethz.ch> neeri@jupiter.ethz.ch (Matthias Ulrich Neeracher) writes: >In article <1992Jan31.071718.11583@reed.edu> orpheus@reed.edu (P. Hawthorne) writes: >> I wonder if we are making too much of this issue. Aside from being able >>to convert between the formats when appropriate, which is easy, how can a >>single application use either hardware or SANE without sacrificing >>performance if the hardware is present? > >I wonder that noone has mentioned this so far, but don't there exist utilities >like Omega SANE which replace SANE calls with coprocessor instructions (i.e. >the first time an applications makes a SANE call, the call is inline replaced >by 6888X instructions) ? Apart from being ugly, this solution seems to work >well enough. Just a note of clarification: Omega SANE doesn't replace calls to SANE with equivalent FPU instructions. Instead, it modifies the jump to the common SANE entry point with a jump directly to the right routine. This is similar to replacing A-Trap instructions with the result of GetTrapAddress. There are other INITs that allow one to compile an application with FPU instructions and then run them on machines lacking an FPU. These INITs trap the FPU instructions on those machines, and route them to SANE to be emulated. > >----- >Matthias Neeracher neeri@iis.ethz.ch > "You must have picked up that copy of Scarlett instead of Inside Mac > when you tried to find the right call..." -- Keith Rollin Oops! Looks like I made an impression on someone! I wonder if this is good or bad... -- - ---------------------------------------------------------------------------- Keith Rollin --- <Taligent .signature under construction> Disclaimer: Pretty soon, I really _won't_ be speaking for Apple... - ------------------------- From: ksand@apple.com (Kent Sandvik) Subject: SANE or Sadie One (was Re: sqrt SUMMARY and Thanks.) Date: 2 Feb 92 23:43:13 GMT Organization: MacDTS Mongols In article <1992Jan31.022148.20407@reed.edu>, orpheus@reed.edu (P. Hawthorne) writes: > > > ABSURD@applelink.apple.com (Tim Dierks, ToyMeister, Cray abuser) writes: > .. This is one of the most difficult things to construct on the Mac at the > .. moment; a program that uses 881 or SANE as required.... > .. Unfortunately, this is currently a problem without a solution. > > It requires some care just to make a program which uses a 6888n and can > warn the user if they don't have one. Adapting the program to whatever > happens to be available does seem a worthy goal, if somewhat ambitious. > It would mean stepping on the toes of mighty Microsoft Excel, so I'm in. > Doesn't Excel do this? How does it do it? Is there a better way? > What does PseudoFPU do again? Never downloaded it, since I have an FPU. > > > .. It's complicated by the fact that they must use seperate libraries for > .. all their math functions... Yes, we have talked about this back and forth inside DTS, and the easy, quick and less-resource taking way is to ship *two* binaries, one for 68881/2 direct op-codes, and one using SANE. You might do all kinds of tricks using abstraction barriers (glue code which calls real calls, canonical data structures, and so on...) - but in the long run, is it worth the time? Kent Sandvik (setq disclaimer "not-speaking-for-Apple") - ------------------------- From: ABSURD@applelink.apple.com (Tim Dierks, Cray abuser) Subject: SANE or Sadie One (was Re: sqrt SUMMARY and Thanks.) Date: 3 Feb 92 21:48:37 GMT Organization: MacDTS, Apple Computer In article <1992Jan31.022148.20407@reed.edu>, orpheus@reed.edu (P. Hawthorne) writes: > To tell the truth, I have been assuming the existence of math hardware > for a good long while now. It has to do with being a speed freak, I think. > If there is a good way to condescend to the lowest common denominator, > I would be disappointed to think that it would significantly affect the > performance for the highest. A note I should make here is that Motorola has announced a chip called the 68040LC, which is a 68040 without a math coprocessor. This would result in a CPU with relatively good integer performance (representing 90%+ of applications), but relatively poor floating point performace. There is some possibility that Apple may at some point release a machine which uses this chip- thus, developers of high-end applications may want to seriously consider adding support for non-FPU machines. Tim Dierks MacDTS, but I speak for myself - ------------------------- From: ABSURD@applelink.apple.com (Tim Dierks, Cray abuser) Subject: SANE or Sadie One (was Re: sqrt SUMMARY and Thanks.) Date: 3 Feb 92 21:48:41 GMT Organization: MacDTS, Apple Computer In article <1992Jan31.022148.20407@reed.edu>, orpheus@reed.edu (P. Hawthorne) writes: > To tell the truth, I have been assuming the existence of math hardware > for a good long while now. It has to do with being a speed freak, I think. > If there is a good way to condescend to the lowest common denominator, > I would be disappointed to think that it would significantly affect the > performance for the highest. A note I should make here is that Motorola has announced a chip called the 68040LC, which is a 68040 without a math coprocessor. This would result in a CPU with relatively good integer performance (representing 90%+ of applications), but relatively poor floating point performace. There is some possibility that Apple may at some point release a machine which uses this chip- thus, developers of high-end applications may want to seriously consider adding support for non-FPU machines. Tim Dierks MacDTS, but I speak for myself - ------------------------- From: lim@iris.ucdavis.edu (Lloyd Lim) Subject: SANE or Sadie One Date: 4 Feb 92 00:54:02 GMT Organization: U.C. Davis - Department of Electrical Engineering and Computer Science In article <1992Jan31.071718.11583@reed.edu> orpheus@reed.edu (P. Hawthorne) writes: > > I wonder if we are making too much of this issue. Aside from being able >to convert between the formats when appropriate, which is easy, how can a >single application use either hardware or SANE without sacrificing >performance if the hardware is present? The key phrase is "without sacrificing performance". You have to have two different sets of code, one with 68881 instructions and one without. It's a hassle to do this in one program. THINK C 5.x has an interesting Universal format. It's 96 bits just like the 68881 format but it copies the exponent part to the unused word also. The conversions make it a bit slower and you still have to convert (to change sizes) when you call SANE. If you could get rid of the automatic conversions and just explicitly convert when you need to (which isn't very often), this seems like an ideal data type to use. To go from 96 to 80, you'd just copy one word and use a different pointer. This can be done in one instruction. I haven't really done this so I could be leaving out a few things... +++ Lloyd Lim Internet: lim@iris.cs.ucdavis.edu America Online: LimUnltd Compuserve: 72647,660 US Mail: 224 Lysle Leach Hall, U.C. Davis, Davis, CA 95616 --------------------------- End of C.S.M.P. Digest **********************